package com.yumeng.mywrite_picture_agent.controller;

import com.yumeng.mywrite_picture_agent.app.ai_kefu;
import jakarta.annotation.Resource;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
@RequestMapping("/ai")
public class AiController {
    @Resource
    private ai_kefu ai_kefu;

    //2.dochat同步改成sse流式接口，主要的调用方法
    @GetMapping(value = "/chat/sse", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
    public Flux<String> doChatWithAiSSE(String message, String chatId) {
        return ai_kefu.doChatByStream(message,chatId);
    }
}
